<#import "/layout/mainLayout.html" as mainLayout />

<#macro mainheading>
    <!--<link href="/plugins/ALTE/bootstrap/css/form-showcase.css" rel="stylesheet"/>-->
    <!--<link href="/plugins/ALTE/bootstrap/css/bootstrap-responsive.css" rel="stylesheet"/>-->
    <!--<link href="/plugins/ALTE/bootstrap/css/bootstrap-overrides.css" type="text/css" rel="stylesheet"/>-->
    <!--<link href="/plugins/ALTE/plugins/morris/morris.css" rel="stylesheet"/>-->
</#macro>
<#assign mainheading = mainheading in mainLayout />

<#macro maincontent>
    <section class="content">
        <div class="row">
            <div class="col-xs-12">
                <table id="usertable" class="table table-bordered  dataTable">
                    <tr>
                        <td rowspan="3" class="col-xs-3">
                            <img style="height: 108px;width:108px"
                                 src="${user.userBaseModel.fPhoto}">
                        </td>
                        <td class="col-xs-4">
                            姓名：${user.userBaseModel.fUsername}

                        </td>
                        <td>
                            姓别： ${user.userBaseModel.fSex!'未知'}
                        </td>
                        <td>
                            出生日期： ${user.fBirthday?string('yyyy-MM-dd')}
                        </td>
                    </tr>
                    <tr>
                        <td>
                            电话： ${user.userBaseModel.fPhone}
                        </td>
                        <td>
                            邮箱： ${user.userBaseModel.fEmail!''}
                        </td>
                        <td>
                            注册时间： ${user.userBaseModel.fIntime?string('yyyy-MM-dd hh:mm:ss')}
                        </td>
                    </tr>
                    <tr>
                        <td>
                            会员到期时间： ${user.fVipdate?string('yyyy-MM-dd')}
                        </td>
                        <td>
                            金币： ${user.fCoin!''}
                        </td>
                        <td>
                            零钱： ${user.fMoney!''}
                        </td>
                    </tr>
                    <tr>
                        <td>
                            个人介绍:${user.fIntroduction!''}
                        </td>
                    </tr>
                </table>
            </div>

        </div>
        <div class="row">
            <div class="box-primary">

                <div class="col-md-12">
                    <div class="nav-tabs-custom">
                        <ul class="nav nav-tabs">
                            <li class="active" onclick="loadCollect()"><a href="#activity"
                                                  data-toggle="tab"
                                                  aria-expanded="true">收藏记录</a></li>
                            <li class="" onclick="loadPlaylist()"><a href="#div_video"
                                                  data-toggle="tab"
                                                  aria-expanded="false"
                                                  id="div_hrefsource">播放记录</a>
                            </li>
                        </ul>
                        <div class="tab-content">
                            <div class="tab-pane active"  id="activity">
                                <!-- Post -->
                                <table class="table table-bordered table-striped dataTable">
                                    <tbody>
                                    <thead>
                                    <tr>
                                        <th>视频类型</th>
                                        <th>视频照片</th>
                                        <th>视频名称</th>
                                        <th>添加时间</th>
                                    </tr>
                                    </thead>
                                    <tbody id="collectContent">


                                    </tbody>
                                </table>

                            </div><!-- /.tab-pane -->
                            <div class="tab-pane" id="div_video">
                                <div class="box-body table-responsive no-padding">
                                    <table class="table table-bordered table-striped dataTable">
                                        <tbody>
                                        <thead>
                                        <tr>
                                            <th>视频类型</th>
                                            <th>视频照片</th>
                                            <th>视频名称</th>
                                            <th>播放时间</th>
                                            <th>添加时间</th>
                                        </tr>
                                        </thead>
                                        <tbody id="playContent">


                                        </tbody>
                                    </table>
                                </div><!-- /.box-body -->

                            </div><!-- /.tab-pane -->
                        </div><!-- /.tab-content -->
                        <div id="pagecontent" class="pagination"></div>
                    </div><!-- /.nav-tabs-custom -->
                </div>
            </div>
        </div>
    </section>

</#macro>
<#assign maincontent = maincontent in mainLayout />

<#macro mainfooter>
    <script type="text/javascript">
        var urlUserid=$.getUrlParam("userid");
        if (!urlUserid){
            window.location.href="/";
        }
        var collect_Data={
            userid:urlUserid,
            pno: 1,
            pagesize: 5,
            allcount:-1
        }
        loadCollect();
        function  loadCollect() {

            $('#pagecontent').html('');
            $.ajax({
                    url: '/api/videolog/getusercollectlog',
                    data: collect_Data,
                    dataType: 'json',
                    success: function (data) {
                        if (mortise_layout.ValidataResult(data)) {
                            if (data.result) {
                                collect_Data.allcount = data.result.count;
                                var html = '';
                                $.each(data.result.list, function (index, item) {
                                    html += getHtml(item);
                                })
                                $('#collectContent').html(html);

                                ShowPage('pagecontent', collect_Data, function (pno) {
                                    collect_Data.pno = pno;
                                    loadCollect();
                                });
                            }
                            else {
                                alert('返回数据错误！');
                            }
                        }
                        else {
                            alert('请求数据失败！');
                        }
                    }
                }
            );
        }
        var play_Data={
            userid:urlUserid,
            pno: 1,
            pagesize: 5,
            allcount:-1
        }
        function  loadPlaylist() {
            $('#pagecontent').html('');
            $.ajax({
                    url: '/api/videolog/geuserplaylog',
                    data: play_Data,
                    dataType: 'json',
                    success: function (data) {
                        if (mortise_layout.ValidataResult(data)) {
                            if (data.result) {
                                play_Data.allcount = data.result.count;
                                var html = '';
                                $.each(data.result.list, function (index, item) {
                                    html += getHtml(item);
                                })
                                $('#playContent').html(html);

                                ShowPage('pagecontent', play_Data, function (pno) {
                                    play_Data.pno = pno;
                                    loadPlaylist();
                                });
                            }
                            else {
                                alert('返回数据错误！');
                            }
                        }
                        else {
                            alert('请求数据失败！');
                        }
                    }
                }
            );
        }
        function  getHtml(obj) {
            var html='<tr>';
            if (obj.fClasstype==1){
                html+="<td>电影</td>"
            }
            html+='<td><img src="'+obj.fObject.fPhoto+'" style="width: 68px;height:68px"></td>';
            html+='<td>'+obj.fObject.fName+'</td>';
            if (obj.fPalytime){
                html+='<td>'+obj.fPalytime+'</td>';
            }
            html+='<td>'+obj.fIntime+'</td>';
            html +="</tr>";
            return html;
        }
    </script>
</#macro>
<#assign mainfooter = mainfooter in mainLayout />
<@mainLayout.page title="师徒管理" />